package p270jp.pxv.android.legacy.fragment;

import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Parcelable;
import androidx.appcompat.app.AlertDialog;
import p014ae.DialogInterface$OnClickListenerC0088h;
import p089d.C2419a;
import p216hn.DefaultConstructorMarker;
import p270jp.pxv.android.legacy.fragment.GenericDialogFragment;
import p325m0.MutabilityOwnership;
import p447qi.Hilt_GenericDialogFragment;
import p603wm.Tuples;

/* compiled from: GenericDialogFragment.kt */
/* renamed from: jp.pxv.android.legacy.fragment.GenericDialogFragment */
/* loaded from: classes2.dex */
public final class GenericDialogFragment extends Hilt_GenericDialogFragment {

    /* renamed from: f */
    public static final C4250a f19066f = new C4250a(null);

    /* compiled from: GenericDialogFragment.kt */
    /* renamed from: jp.pxv.android.legacy.fragment.GenericDialogFragment$DialogEvent */
    /* loaded from: classes2.dex */
    public interface DialogEvent extends Parcelable {
    }

    /* compiled from: GenericDialogFragment.kt */
    /* renamed from: jp.pxv.android.legacy.fragment.GenericDialogFragment$a */
    /* loaded from: classes2.dex */
    public static final class C4250a {
        public C4250a(DefaultConstructorMarker eVar) {
        }

        /* renamed from: a */
        public static GenericDialogFragment m4606a(C4250a aVar, String str, String str2, String str3, String str4, DialogEvent dialogEvent, DialogEvent dialogEvent2, int i) {
            if ((i & 2) != 0) {
                str2 = null;
            }
            if ((i & 8) != 0) {
                str4 = null;
            }
            if ((i & 16) != 0) {
                dialogEvent = null;
            }
            GenericDialogFragment genericDialogFragment = new GenericDialogFragment();
            Bundle bundle = new Bundle();
            bundle.putString("arguments_title", str);
            if (str2 != null) {
                bundle.putString("arguments_message", str2);
            }
            bundle.putString("arguments_positive_label", str3);
            if (str4 != null) {
                bundle.putString("arguments_negative_label", str4);
            }
            if (dialogEvent != null) {
                bundle.putParcelable("arguments_positive_event", dialogEvent);
            }
            genericDialogFragment.setArguments(bundle);
            return genericDialogFragment;
        }
    }

    /* renamed from: f */
    public final void m4607f(DialogEvent dialogEvent) {
        getParentFragmentManager().m11253c0("fragment_request_key_generic_dialog_fragment", C2419a.m7858f(new Tuples("fragment_result_key_dialog_event", dialogEvent)));
    }

    @Override // androidx.fragment.app.DialogFragment
    public Dialog onCreateDialog(Bundle bundle) {
        AlertDialog.C0305a aVar = new AlertDialog.C0305a(requireContext());
        Bundle requireArguments = requireArguments();
        MutabilityOwnership.m3746l(requireArguments, "requireArguments()");
        aVar.f1085a.f1054d = requireArguments.getString("arguments_title");
        if (requireArguments.containsKey("arguments_message")) {
            aVar.f1085a.f1056f = requireArguments.getString("arguments_message");
        }
        aVar.m12007g(requireArguments.getString("arguments_positive_label"), new DialogInterface.OnClickListener(requireArguments, this) { // from class: qi.b

            /* renamed from: a */
            public final /* synthetic */ Bundle f25436a;

            /* renamed from: b */
            public final /* synthetic */ GenericDialogFragment f25437b;

            {
                this.f25436a = r1;
                this.f25437b = r2;
            }

            @Override // android.content.DialogInterface.OnClickListener
            public final void onClick(DialogInterface dialogInterface, int i) {
                Bundle bundle2 = this.f25436a;
                GenericDialogFragment genericDialogFragment = this.f25437b;
                GenericDialogFragment.C4250a aVar2 = GenericDialogFragment.f19066f;
                MutabilityOwnership.m3745m(bundle2, "$arguments");
                MutabilityOwnership.m3745m(genericDialogFragment, "this$0");
                GenericDialogFragment.DialogEvent dialogEvent = (GenericDialogFragment.DialogEvent) bundle2.getParcelable("arguments_positive_event");
                if (dialogEvent != null) {
                    genericDialogFragment.m4607f(dialogEvent);
                }
                genericDialogFragment.dismiss();
            }
        });
        if (requireArguments.containsKey("arguments_negative_label")) {
            aVar.m12010d(requireArguments.getString("arguments_negative_label"), new DialogInterface$OnClickListenerC0088h(requireArguments, this, 2));
        }
        return aVar.m12013a();
    }
}
